package cn.signalpha.modules.shop.mapper;

import cn.signalpha.modules.shop.entity.Order;
import cn.signalpha.modules.shop.vo.OrderVO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

/**
 * 订单 Mapper 接口
 *
 * @author suguangjun
 */
public interface OrderMapper extends BaseMapper<Order> {

	/**
	 * 自定义分页
	 */
	List<OrderVO> selectOrderPage(IPage page, @Param("params") Map<String, Object> params);

	/**
	 * 状态统计
	 */
	Map<String, Object> countStatus(@Param("params") Map<String, Object> params);

	/**
	 * 购买用户人数
	 */
	long getBuyerUserCount(@Param("params") Map<String, Object> params);

	/**
	 * 支付成功
	 */
	int updateByPaySuccess(@Param("orderNoList") List<String> orderNoList, @Param("payType") String payType);

	/**
	 * 获取某哥店铺下个单的用户
	 */
	@Select("SELECT user_id FROM shop_order WHERE seller_id = #{sellerId} GROUP BY user_id")
	List<Long> selectUserIdBySellerId(@Param("sellerId") Long sellerId);
}
